clear all
set more off
cd C:\BMOcode\

use BMO_Pseudodata_main.dta, clear

qui pctile dispose = denom, n(10) 
gen Dstocksize_low3rd = (denom_ord<=r(r3)) 
gen Dstocksize_top3rd = (denom_ord>=r(r7)) 
drop dispose

order region firm A*

*** Scale regional tax-payers, wealth, and civil servants by population
gen Ataxpayers_s = Ataxpayers/Apopulation
gen Awealth_s = Awealth/Apopulation
gen Acivil_s = Acivil/Apopulation

*** Generate regional-level ownership characteristics
gen LDfirms = (Dstocksize_top3rd==1)
gen SDfirms = (Dstocksize_low3rd==1)

* Number of LD/SD firms, firms w a board, and total firms by region
by region, sort: egen N_SD = sum(SDfirms)
by region, sort: egen N_LD = sum(LDfirms)
by region, sort: egen N_DR = sum(DR)
by region, sort: egen AmtNN = count(LDfirms)

* Fraction of LD/SD sample firms and firms w a board by region
gen ALDfrac = N_LD/AmtNN
gen ASDfrac = N_SD/AmtNN
gen ADRfrac = N_DR/AmtNN
drop N_LD N_SD N_DR

* Average denomination in regions
by region, sort: egen Aavg_denom = mean(denom_ord)
replace Aavg_denom = Aavg_denom/1000                         /* avg denomination in thousands */

egen tag_region = tag(region)
gen Doslo = (region=="Kristiania")

label var Ataxpayers_s "Tax payers per capita"
label var Awealth_s "Agg. wealth per capita"
label var Acivil_s "Civil servants per capita"
label var ALDfrac "LD-firms (frac.)"
label var ASDfrac "SD-firms (frac.)"
label var ADRfrac "Firms w/ board (frac.)"
label var Aavg_denom "Avg. denomination"

*** Tabel 11: Regional wealth dispersion and ownership strutures
do BMO_table11.do

*** Table 12: Board existence instrumented with civil servants
do BMO_table12.do

*** Table B3: Summary Statistics: Regional sample
do BMO_tableB3.do

*** Figure 3: Tax payers and share denomination in regions
do BMO_figure3.do




